import com.beans.UserController2;
import com.beans.UserController3;
import com.beans.UserController4;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.jws.soap.SOAPBinding;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: H_tao_X
 * Date: 2022-11-17
 * Time: 21:02
 */
public class App3 {
    public static void main(String[] args) {
        ApplicationContext context =
                new ClassPathXmlApplicationContext("spring-config.xml");
        // bean 名字 和 类型 的方式 获取 Bean
        // 通过 属性注入
        UserController2 userController2 = context.getBean("userController2",UserController2.class);
        userController2.sayHi();

        // 通过 构造方法注入
        UserController3 userController3 = context.getBean("userController3",UserController3.class);
        userController3.sayHi();

        // 通过 setter 注入
        UserController4 userController4 = context.getBean("userController4", UserController4.class);
        userController4.sayHi();
    }
}
